#ifndef _OBJMODEL_H_
#define _OBJMODEL_H_

#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>

#include "glextedit.h"

#include "texture.h"

struct Vertex
{
    float x, y, z;
    float nx, ny, nz;
    float u, v;
};

class ObjModel
{
public:
    ObjModel(const char* filename);
    ~ObjModel();

    int getVboId() const;
    int getNumVertices() const;
    const Texture& getTexture() const;

private:

    struct ObjVertex;
    struct ObjUv;
    struct ObjFace;

    void read(const char* filename);
    void readMaterial(const char* filename);

    void createHwBuffers();

    Vertex* _vertices;
    int _numVertices;
    int _vboId;

    Texture* _texture;
};

#endif // _OBJMODEL_H_
